package com.yangrui.app.service.impl;

import com.yangrui.app.entity.Video;
import com.yangrui.app.mapper.VideoMapper;
import com.yangrui.app.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VideoServiceImpl implements VideoService {

    @Autowired
    private VideoMapper videoMapper;

    @Override
    public List<Video> list() {
        return videoMapper.list();
    }

    @Override
    public Video selectDetailById(Integer id) {
        Video video = videoMapper.selectDetailById(id);
        return video!=null? video : new Video(0,"视频不存在");
    }
}

